package com.zhenyi.xiaohuoche.interceptor;

import javax.servlet.http.HttpServletRequest;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

public class XHCRefInterceptor implements Interceptor {

	@Override
	public void intercept(Invocation inv) {
		inv.invoke();
		Controller controller = inv.getController();
		HttpServletRequest request = controller.getRequest();
		// Enumeration<String> header = request.getHeaderNames();
		// while (header.hasMoreElements()) {
		// String string = (String) header.nextElement();
		// String value = request.getHeader(string);
		// System.out.println(string + " - " + value);
		// }
		String referer = request.getHeader("Referer");
		controller.setAttr("referer", referer);

	}

}
